package com.example.dao;

import com.example.entity.Stock;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface StockDao extends JpaRepository<Stock, Long> {

    @Query(value = "select * from stock where name like %?1%", nativeQuery = true)
    List<Stock> findStockByName(String name);

    @Query(value = "select * from stock where manufacturer like %?1%", nativeQuery = true)
    List<Stock> findStockByManuFacturer(String make);

    @Query(value = "select * from stock where supplier like %?1%", nativeQuery = true)
    List<Stock> findStockBySupplier(String supplier);
}
